/**
 * 
 */
package com.nari.interfaces.decipher.common.warn;

import java.util.Date;

import com.nari.interfaces.model.IMissionFailureLog;

/**
 * 解析器异常日志工具
 * @author Xiaopeng
 * @date 2015-2-5
 */
public class DecipherWarnLogger {

	/**
	 * 任务异常实例化
	 * @param meterType 计量热表类型
	 * @param measureMeterNo 任务标识一：集中器号/热表表号
	 * @param recordTime 任务标识二：抄表日期(yyyy-MM-dd)
	 * @param auditLog 任务异常审计(异常信息)
	 * @param reasonDesc 任务异常总结(问题简述)
	 * @return
	 * @throws Exception
	 * @author Xiaopeng
	 * @date 2015-2-6
	 */
	public static IMissionFailureLog getMissionLogInstance(String meterType, String measureMeterNo, 
			String recordTime, String auditLog, String reasonDesc) throws Exception {
		IMissionFailureLog missionLog = new IMissionFailureLog();
		//标志热表表号
		if(measureMeterNo==null || "".equals(measureMeterNo.trim())) {
			measureMeterNo = "XXXXXX";
		}
		if(DecipherWarnConstants.logger_meterType_con.equals(meterType)) {
			measureMeterNo = "[集]" + measureMeterNo;
		} else if(DecipherWarnConstants.logger_meterType_hm.equals(meterType)) {
			measureMeterNo = "[热]" + measureMeterNo;
		} else if(DecipherWarnConstants.logger_meterType_am.equals(meterType)) {
			measureMeterNo = "[分]" + measureMeterNo;
		} else if(DecipherWarnConstants.logger_meterType_tp.equals(meterType)) {
			measureMeterNo = "[温]" + measureMeterNo;
		} else if(DecipherWarnConstants.logger_meterType_pda.equals(meterType)) {
			measureMeterNo = "[掌机]" + measureMeterNo;
		} else {
			measureMeterNo = "[未知]" + measureMeterNo;
		}
		missionLog.setMeasureMeterNo(measureMeterNo);
		//抄表日期
		if(recordTime==null || "".equals(recordTime.trim())) {
			recordTime = "XXXX-XX-XX";
		}
		missionLog.setRecordTime(recordTime);
		missionLog.setAuditLog(auditLog);
		missionLog.setAuditTime(new Date());
		missionLog.setReasonDesc(reasonDesc);
		return missionLog;
	}
}
